<!--
# Copyright (c) 2024 Bird Software Solutions Ltd
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Neil Mackenzie - initial API and implementation
-->
{% extends 'base.html' %}

{% block title %}LDM to SDD Hierarchy Conversion Results{% endblock %}

{% block content %}
<h1 style="text-align: center;">LDM to SDD Hierarchy Conversion Results</h1>
<a href="{% url 'pybirdai:bird_diffs_and_corrections' %}">Back to BIRD Export Diffs and Corrections</a>

{% if not csv_data %}
    <p>No conversion results found. Please run the conversion first.</p>
{% else %}
    {% for filename, data in csv_data.items %}
        <h2>{{ filename }}</h2>
        <div class="table-container">
            <table>
                <thead>
                    <tr>
                        {% for header in data.headers %}
                            <th>{{ header }}</th>
                        {% endfor %}
                    </tr>
                </thead>
                <tbody>
                    {% for row in data.rows %}
                        <tr>
                            {% for cell in row %}
                                <td>{{ cell }}</td>
                            {% endfor %}
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    {% endfor %}
{% endif %}

<style>
    .table-container {
        width: 100%;
        overflow-x: auto;
        margin: 1em 0;
    }
    table {
        border-collapse: collapse;
        width: 100%;
        margin-bottom: 2em;
    }
    th, td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }
    th {
        background-color: #f2f2f2;
        position: sticky;
        top: 0;
    }
    tr:nth-child(even) {
        background-color: #f9f9f9;
    }
    tr:hover {
        background-color: #f5f5f5;
    }
    h2 {
        margin-top: 2em;
        color: #0066cc;
    }
    a {
        display: inline-block;
        margin: 1em 0;
        color: #0066cc;
        text-decoration: none;
    }
    a:hover {
        text-decoration: underline;
    }
</style>
{% endblock %} 